Retrieve the zero-based index of the first visible item in the list box portion of a combo box
#Include <GuiCombo.au3>
_GUICtrlComboGetTopIndex($h_combobox)
Parameters
$h_combobox | control id/control hWnd |
Return Value
Success: | Returns is the index of the first visible item in the list box of the combo box. |
Failure: | Returns $CB_ERR if the message fails. |
Remarks
Initially, the item with index 0 is at the top of the list box,
Related
_GUICtrlComboSetTopIndex
Example
#include <GuiConstants.au3>
#include <GuiCombo.au3>
Opt('MustDeclareVars',1)
Dim $Combo,$Btn_Exit,$Status,$msg,$Btn_Get
GuiCreate("ComboBox Get Top Index", 392, 254)
$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,BitOR($CBS_SIMPLE,$CBS_DISABLENOSCROLL,$WS_VSCROLL))
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language|designed|for|automating")
$Btn_Get = GuiCtrlCreateButton("Get Top Index", 150, 140, 90, 30)
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Top Index: " & _GUICtrlComboGetTopIndex($Combo))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Get
GUICtrlSetData($Status,"Top Index: " & _GUICtrlComboGetTopIndex($Combo))
EndSelect
WEnd
Exit